{extend name="index_layout"/}
{block name="main"}
<div class="layui-card">
    <div class="layui-card-header">入库管理</div>
    <div class="layui-card-body">
        <div class="layui-form">
            <div style="margin-bottom: 15px;width: 350px;display: flex;align-items: center">
                <label for="" style="width: 120px;margin-right: 10px">扫码枪入库:</label>
                <input type="text" onblur="showInfo()" id="barcodeInput" class="layui-input">
            </div>
            <table class="layui-hide" id="currentTable" lay-filter="currentTable"
                   data-auth-recyclebin="{:$auth->check('warehousing/recyclebin')}"
            ></table>
        </div>
    </div>
</div>

{/block}
{block name="script"}

<script>
    function showInfo() {
        var barcode = $('#barcodeInput').val();
        if(!barcode){
            return false;
        }
        console.log(barcode);
        yzn.open('入库', '/admin/Warehousing/getGoods?barcode=' + barcode, 800, 600)
    }
</script>


<script type="text/javascript">
    layui.use('yznTable', function () {
        var table = layui.yznTable;

        var init = {
            table_elem: '#currentTable',
            table_render_id: 'currentTable',
            modify_url: "{:url('multi')}",
            recyclebin_url: "{:url('recyclebin')}",
        };

        table.render({
            init: init,
            toolbar: ['refresh'],
            url: '{:url("index")}',
            cols: [
                [
                    {type: 'checkbox', fixed: 'left'},
                    {field: 'id', title: 'ID', minWidth: 80,search: false},
                    {field: 'number', align:'center',title: '商品编码', searchOp: 'LIKE', minWidth: 150},

                    {field: 'goods_name', align:'center',title: '商品名称', searchOp: 'LIKE', minWidth: 100},
                    {field: 'nums', align:'center',title: '入库数量', minWidth: 100,search: false},
                    {field: 'stock_price', align:'center',title: '单价', minWidth: 80,  searchTip: '单价',search: false},
                    {field: 'total_price', align:'center',title: '总价格', minWidth: 90,  searchTip: '总价格',search: false},
                    {
                        field: 'create_time',
                        title: '创建时间',
                        minWidth: 80,
                        width: 180,
                        search: 'range',
                        templet: yznTable.formatter.datetime
                    },
                    {
                        field: 'update_time',
                        title: '更新时间',
                        minWidth: 80,
                        width: 180,
                        search: 'range',
                        templet: yznTable.formatter.datetime
                    },

                ]
            ],
            page: {}
        });

        yznTable.bindevent();
    });
</script>
{/block}

<style>
    /* 模态框样式 */
    .modal {
        display: none; /* 默认不显示 */
        position: fixed;
        z-index: 1050; /* 确保模态框在页面最上层 */
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        overflow: auto;
        background-color: rgba(0, 0, 0, 0.5); /* 背景半透明 */
    }

    .modal-dialog {
        position: relative;
        width: auto;
        margin: 30px auto;
    }

    .modal-content {
        position: relative;
        background-color: #fefefe;
        margin: 0;
        padding: 20px;
        border: 1px solid #888;
        width: 100%; /* 可以根据需要调整宽度 */
        box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); /* 添加阴影效果 */
        animation-name: modalopen;
        animation-duration: 0.4s;
    }

    .close-btn {
        color: #aaa;
        float: right;
        font-size: 28px;
        font-weight: bold;
    }

    .close-btn:hover,
    .close-btn:focus {
        color: black;
        text-decoration: none;
        cursor: pointer;
    }

    /* 模态框动画 */
    @keyframes modalopen {
        from {
            opacity: 0
        }
        to {
            opacity: 1
        }
    }
</style>